import React, { Component } from 'react'
import PubSub from 'pubsub-js'

export default class Public extends Component {

    componentDidMount(){
        this.token =  PubSub.subscribe( "My Topic", ( msg, data ) => {
            console.log( msg );
        })
    }

    componentWillUnmount(){
        PubSub.unsubscribe( this.token );
    }

    render() {
        
        return (
            <div>
                Public
            </div>
        )
    }
}
